
package madkit.projectmultiagent;

import madkit.kernel.*;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;

//import com.sun.xml.internal.fastinfoset.algorithm.BuiltInEncodingAlgorithm.WordListener;

import java.awt.*;
import java.awt.event.*;

@SuppressWarnings("serial")
public class AgentSuperviseurGUI extends JPanel implements ActionListener {

	AgentSuperviseur ag;
	
	 AgentSuperviseurGUI(AgentSuperviseur _ag){
	    ag = _ag;
	    setLayout(new BorderLayout());
	    JPanel buttonList = new JPanel();
		JButton helloSpecButt = new JButton("Hello spec");
		helloSpecButt.addActionListener(this);
		JButton helloExpButt = new JButton("Hello expert");
		helloExpButt.addActionListener(this);		
		JButton helloDevButt = new JButton("Hello Dev");
		helloDevButt.addActionListener(this);
		JButton sendButt = new JButton("Spec?");
		sendButt.addActionListener(this);
		JButton killButt = new JButton("Sepuku");
		killButt.addActionListener(this);
		buttonList.add(helloSpecButt);
		buttonList.add(helloExpButt);
		buttonList.add(helloDevButt);
		buttonList.add(sendButt);
		buttonList.add(killButt);
		add(buttonList,BorderLayout.NORTH);   
		OPanel output = new OPanel();
        add(output,BorderLayout.CENTER);
        ag.setOutputWriter(output.getOut());
	 }

	public void actionPerformed(ActionEvent e) {
         if (e.getActionCommand().equals("Hello spec")){
			ag.HelloSpec();//println("Hello");
         } else if (e.getActionCommand().equals("Hello expert")){
 			ag.HelloExpert();
         } else if (e.getActionCommand().equals("Hello Dev")){
  			ag.HelloDev();
         } else if (e.getActionCommand().equals("Spec?")){
			ag.sendHelloToAll();
         } else if (e.getActionCommand().equals("Sepuku")){
			ag.die();
         }
    }
    
}
/****************************************************************
  
   File created using the MadKit designer
   Thanks for using MadKit - 2008
   
*****************************************************************/
